<!--
 * @Descripttion: 
 * @Author: qinyonglian
 * @Date: 2021-02-07 10:16:28
 * @LastEditors: qinyonglian
 * @LastEditTime: 2021-02-07 10:36:25
-->
<template>
  <div class="train">
    <Header>
      <template #extra>
        <span>详情</span>
      </template>
      <template #left-extra>
        <i class="jeicon jeicon-angle-left" />
      </template>
    </Header>
    <div class="mui-content mui-fullscreen">
      <h5 class="require">
        工作地点
      </h5>
      <div class="mui-input-row">
        <input
          v-model="model.RB_GZJD_NAME"
          type="text"
        >
      </div>

      <h5 >
        归属日期
      </h5>
      <div class="mui-input-row">
        <input
          v-model="model.RB_GSRQ"
          @tap="selectTime({field:'RB_GSRQ'})"
          type="text"
          readonly
        >
      </div>
      <div
      class="je-audio-btn je-fixed-button"
      @tap="onSave()"
      >
      保存
    </div>
    </div>
  </div>
</template>
<script>

import Header from '@/components/header';

export default {
  name: 'detail',
  components: {
    Header
  },
  data() {
    return {
      model:{
        RB_GZJD_NAME:'',
        RB_GSRQ:'',
        A_RB_ID:''
      }
    };
  },
  watch: {
   
  },
  created() {
    const { item } = this.$route.query;
    this.model.RB_GZJD_NAME = item.RB_GZJD_NAME;
    this.model.RB_GSRQ = item.RB_GSRQ;
    this.model.A_RB_ID = item.A_RB_ID
  },
  mounted() {
  
  },
  methods: {
    /**
     * 选择时间
     * @param {Object} options 选项
     */
    selectTime(options) {
      const me = this;
      let value = me.model[options.field] || '';
      if (value.length > 0) {
        value = value.substring(0, value.length - 3);
      }
      me.picker = new mui.DtPicker({type: 'date', value });
      me.picker.show((rs) => {
        me.$set(me.model, options.field, `${rs.text}`);
        me.picker.dispose();
        me.picker = null;
      });
    },
    /** 
     * 保存
    */
    onSave(){
      JE.ajax({
        url:'/je/doUpdate',
        params:{
          funcCode: 'A_RB',
          tableCode: 'A_RB',
          A_RB_ID:this.model.A_RB_ID,
          RB_GSRQ:this.model.RB_GSRQ,
          RB_GZJD_NAME:this.model.RB_GZJD_NAME,
        },
        success:(obj)=>{
          if(obj.success){
            JE.msg('保存成功！');
            //this.$router.go(-1);  直接返回列表
            JE.fire('JE-PLUGIN-LOG', 'refreshIndex');
          }else{
            JE.alert('保存失败！');
          }
          
        }
      });
    }
  },
};
</script>
<style lang="less" scoped>
  @import '~@/theme/index.less';
  .train{
    .mui-content{
    padding-top:unit(45 * @hd, px) !important;
    padding:unit(10 * @hd, px);
    background-color: #f2f2f2;
    overflow-y: auto;
    .header-img{
      width: 100%;
      // background: url('./../../../assets/logo.png') no-repeat center;
      // padding: 10 * @hd 0;
      margin:unit(19 * @hd, px) auto unit(5 * @hd, px);
      // background-size: 35%;
      // border-radius: 20px;
      .header-text{
        font-size: 15px * @hd;
        line-height: 20 * @hd;
        text-align: justify;
        background:rgba(255, 255, 255, 0.8);
        padding: 15 * @hd;
        border-radius: 10 * @hd;
        box-shadow: -5px 5px 10px 0px rgba(0, 0, 0, 0.15);
        img{
          vertical-align: top;
          display: inline-block;
        }
      }
    }
    h5{
      padding:unit(10 * @hd, px);
      &.require::before{
        content: '*';
        color:red;
      }
    }
    .margin-bottom-size{
      margin-bottom: unit(15 * @hd, px);
    }
    .mui-input-row{
      input[type=text],
      textarea{
        border: 1px solid rgba(0,0,0,.1);
        background-color:#fff;
      }
    }
    .mui-checkbox label, .mui-radio label{
      line-height: 20 * @hd;
      font-size: 16px * @hd;
    }
    .mui-checkbox input[type=checkbox], .mui-radio input[type=radio]{
      top:4 * @hd;
    }
  }
  }
</style>
